<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

	<ui:composition 
	  xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      template="/view/templates/templateLayout.xhtml">
      
      <ui:define name="conteudo">  
      <link rel="stylesheet" type="text/css" href="./estilos.css"/>     	
  	
<h:form id="formConsultarMarca" prependId="false">  
	<p:panel id="panelConsultarMarca" style="margin-bottom:20px; "> 
	<f:facet name="header">
		<h:outputText value="Consultar Marca" styleClass="outputTextTitulo"/>
	</f:facet> 
 	<p:messages id="messagesConsultarMarca" autoUpdate="true" closable="true" /> 
    	<h:panelGrid id="idPanelGridMarca" columns="2" style="margin-top:20px; margin-right:10%;">  
            <h:outputLabel value="Código" styleClass="outputLabel" />  
            <h:outputLabel value="Marca" styleClass="outputLabel" /> 
            
            <p:inputText value="#{marcaBean.marca.idMarca}" styleClass="inputId">  
  				<p:ajax  listener="#{marcaBean.onChangeMarca}" render="idPanelGridMarca" />
            </p:inputText>  
  			<p:autoComplete  value="#{marcaBean.marca.descricao}" completeMethod="#{marcaBean.completeMarca}"  >
            	<p:ajax event="itemSelect" listener="#{marcaBean.handleSelectMarca}" update="idPanelGridMarca" />
			</p:autoComplete>   
        </h:panelGrid>  
    </p:panel>  
    <p:commandButton value="Consultar" actionListener="#{marcaBean.findMarca}" update="dataTableMarca" style="margin-right:20px; margin-left:10px;" /> 
	<p:commandButton value="Novo" action="#{marcaBean.newMarca}" style="margin-right:20px;" /> 
	<p:commandButton value="Limpar" actionListener="#{marcaBean.clean}" update="idPanelGridMarca, dataTableMarca" style="margin-right:20px;" />
    		
   		
    <p:dataTable id="dataTableMarca" var="Marca" value="#{marcaBean.dmMarca}"  
    			 rowKey="#{Marca.idMarca}" selectionMode="single"
    			 style="padding-top:20px; width:40%" paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15">    
		<p:column style="text-align:center; width:4%;" sortBy="#{Marca.idMarca}">  
            <f:facet name="header">  
                <h:outputText value="Código" />  
            </f:facet>  
            <h:outputText value="#{Marca.idMarca}" />  
        </p:column>  
  
        <p:column sortBy="#{Marca.descricao}">  
            <f:facet name="header">  
                <h:outputText value="Marca" />  
            </f:facet>  
            <h:outputText value="#{Marca.descricao}" />  
        </p:column>  
        
        <p:column style="width:4%; text-align:center">  
        	<f:facet name="header">
        	 	<h:outputText value="Editar" />
        	</f:facet>
         	<p:commandButton id="selectButtonEditar" action="#{marcaBean.editarMarca}" icon="ui-icon-pencil" title="Detail" />
        </p:column> 
        
        <p:column style="width:4%; text-align:center ">  
        	<f:facet name="header">
        	 	<h:outputText value="Excluir" />
        	</f:facet>
         	<p:commandButton id="selectButtonDelete" action="#{marcaBean.excluirMarca}" icon="ui-icon-trash" title="Delete" />
        </p:column>
    </p:dataTable>   
 
</h:form>  	


</ui:define>
</ui:composition>
